package com.disys.common;

import java.io.Serializable;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * @author Ubaid Raja
 * 
 */

public class ConfigurationLoader implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5499009844456104530L;

	private static final transient Logger logger = Logger.getLogger(ConfigurationLoader.class.getName());

	private static Properties prop = null;

	private ConfigurationLoader() {

	}

	static {
		try {
			prop = new Properties();
			prop.load(ConfigurationLoader.class.getClassLoader().getResourceAsStream("conf.properties"));
		} catch (Exception ex) {
			logger.error(ex);
		}
	}

	public static Properties getProperties() {
		return prop;
	}

	public static int getPollingInterval() {
		try {
			return Integer.parseInt(prop.getProperty("POLLING_INTERVAL"));
		} catch (Exception ex) {
			return 20;
		}
	}

	public static int getJobDetPollingInterval() {
		try {
			return Integer.parseInt(prop.getProperty("JOB_DET_POLLING_INTERVAL"));
		} catch (Exception ex) {
			return 20;
		}
	}

	public static int getPageSize() {
		try {
			return Integer.parseInt(prop.getProperty("PAGE_SIZE"));
		} catch (Exception ex) {
			return 10;
		}
	}

	public static String getPropertyValue(String property) {
		return prop.getProperty(property);
	}

	// public static void main(String args[])
	// {
	// System.out.println(ConfigurationLoader.getEnvRoot());
	// }

}
